home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Cream of the Crop 1
/
Cream of the Crop 1.iso
/
CAD
/
AC2VIV.ARJ
/
AC2VIV.DOC
next >
Wrap
Text File
|
1992-04-14
|
18KB
|
659 lines
AC2VIV 1.0
Autocad Release 11 to Vivid 2.0 Translator
April, 1992
Copyright 1992 by Roy Hirshkowitz
TABLE OF CONTENTS
INTRODUCTION...........................2
GETTING STARTED........................3
1. CREATING A 3-D MODEL...............4
A. LAYER USAGE....................4
B. SPECIAL VIVID BLOCKS...........5
C. STANDARD AUTOCAD ENTITIES......6
2. ADDING STUDIO & LIGHTS.............9
A. STUDIO STRUCTURE...............9
B. LIGHTS........................10
3. VIEWING THE MODEL.................11
4. RUNNING THE TRANSLATOR............11
Autocad and Autolisp are registered trademarks of Autodesk, Inc.
Vivid 2.0 is copyright Steven B. Coy
-1-
INTRODUCTION
AC2VIV is designed to work in conjunction with Autocad R11 and Stephen
Coy's (Vivid Software) raytracer Vivid 2.0. Some familiarity with both
of these programs is assumed. It is heartily recommended that the 386
specific versions of both of these programs be used. Further hearty
recommendations include a minimum of 8 MB memory and plenty of play
space on your hard disk, although all of the programs will work with
less.
AC2VIV is a collection of Autolisp routines and support files designed
to translate Autocad R11 drawings into Vivid input files. The
translator works within the drawing editor session and currently
provides a nearly complete "front-end" for Vivid. By making use of
this translator, a user is able to construct a 3d-model, select a
viewpoint, add lights and specify a Vivid studio structure, all within
Autocad. At this time, surface definitions must still be generated
outside of Autocad as text files, although future releases may remedy
this.
Files included in this package:
AC2VIV.LSP The Autolisp translation routines.
AC2VIV.DOC This document.
LICENSE.DOC Registration information
V_STUDIO.DWG Autocad dwg file containing the studio definition.
L_DIRECT.DWG Autocad dwg files of light definitions.
L_POINT.DWG
L_SPOT.DWG
L_SPHERE.DWG
V_SPHERE.DWG Autocad dwg files of special Vivid primitives.
V_DISK.DWG
V_DISK2.DWG
V_CONE##.DWG
-2-
GETTING STARTED
AC2VIV is loaded by typing:
(LOAD "AC2VIV")
at the command prompt or by appending it to ACAD.LSP for automatic
loading. It is invoked by typing:
AC2VIV
The process of building, translating and rendering a model usually goes
something like this:
1. A 3d-model is created in AutoCAD.
2. Lights and a studio structure are added to the model.
3. A perspective view of the model is created using Autocad's DVIEW
command.
4. The translation is run and a Vivid input file produced.
5. Autocad is exited and surface definitions created.
6. Vivid is executed with the .v file created by AC2VIV.
The first four of these steps are explored in more detail in the pages
which follow. For help with the last two, refer to VIVID.DOC, the
manual included with the Vivid executables.
-3-
1. CREATING A 3-D MODEL
AC2VIV currently recognizes almost all of Autocad's 3d entities as well
as some special Vivid primitives (for a complete listing of these see
below.)
A. LAYER USAGE
It is crucial when building a model designed for input to this
translator, that careful attention is paid to the layers on which
entities are drawn. In the Vivid input file which is produced from the
model, your layer names will stand for different materials. For
example, if the model has a layer called STEEL, all the entities on
that layer will follow the surface definition for STEEL. The
translator accomplishes this by adding the line:
#include STEEL.VS
to the Vivid input file. Vivid will then look for a text file called
STEEL.VS which should contain an appropriate surface definition for
steel. Currently these .vs files must be created outside of Autocad,
using a text editor. <<LAYER NAMES CONTAINING 3D ENTITIES SHOULD BE 8
CHARACTERS OR LESS,>> since they will be used by Vivid as DOS filenames
when it searches for material definitions.
If dependent layer names are present from Xrefs contained within the
drawing, the dependent portion of the layer name will be stripped out,
and only the main layer name used for a surface definition. I.e. an
entity on layer TEST1|TEST3|STEEL will appear after the same surface
definition as an entity on layer STEEL.
If blocks are inserted which contain entities drawn on layer 0, those
entities will be "transparent", i.e. they will appear after the surface
definition of the layer on which the block was inserted. For example
if a block is inserted on layer STEEL, all of its entities which are
drawn on layer 0 will appear after the surface definition for STEEL.
Currently Vivid 2.0 does not permit leading numerals or "-" characters
to appear in filenames. Therefore layer names such as "0", "1STEEL",
or "STEEL-1" will not generate valid input.
<<ONLY LAYERS WHICH ARE THAWED AND ON WILL BE USED FOR TRANSLATION>>
-4-
B. SPECIAL VIVID BLOCKS
Vivid provides some geometric primitives which do not correspond
directly to Autocad entities. These include spheres, rings and cones.
While similar looking objects can be constructed in Autocad using
meshes, these objects will translate into a large number of Vivid
primitives, making them inefficient. In addition, because these
objects are composed of individual facets (even after "smoothing" {see
below}), the results are often not as good as with the original
primitive. For example, using Autocad's 3d.lsp routines, the standard
"sphere" is constructed out of a 16 x 16 mesh. In order to produce a
smooth appearing object, this pseudo-sphere needs to be translated into
approx. 500 triangular patches. Even after doing this, the resulting
object will cast "faceted" shadows. In contrast, using a true Vivid
sphere only one primitive is provided, and the shadows it casts will be
smooth.
To implement some of these Vivid primitives, AC2VIV recognizes certain
block names as containing special geometric information. These blocks
are included as separate .dwg files, each one containing an Autocad
mesh representation of the Vivid primitive. In order for these blocks
to work properly they must not be renamed. If they are renamed, AC2VIV
will treat them like any other mesh and translate them accordingly.
The blocks can be scaled, rotated, moved, and inserted into a UCS with
any arbitrary orientation. The x y and z scale factors must be equal.
Currently the recognized blocks are:
<V_SPHERE>
This is a sphere with a radius of 1.
<V_DISK>
This is a flat disk. It translates to a Vivid ring with an inner
radius of 0.
<V_DISK2>
This is a half disk, otherwise identical to V_DISK
<V_CONE##>
These blocks are pointy Vivid cones with a base radius of 1 and an apex
radius of 0. The ratio of the height of the cone to its radius is
given by #-- i.e. v_cone4 is a cone whose height is 4 units.
-5-
C. STANDARD AUTOCAD ENTITIES
(In the discussion which follows, the Autocad definitions of the terms
"thickness" and "width" are used: "thickness" refers to extrusion
depth and "width" refers to 2dpolylines and is a planar attribute.)
Nearly all Autocad surfaces are translated into Vivid primitives.
Entities which do not have surfaces, such as lines (without thickness),
points, text entities, etc. are ignored. Blocks and nested blocks ARE
supported. Currently, the following entities are <<NOT>> translated:
<spline or curve fit entities>
<2dpolylines with variable width arcs>-- arcs with constant widths,
including thick and wide arcs are translated.
<circles w/ thicknesses of 0>-- Although Autocad treats circles as
surfaces, AC2VIV does not. Thick circles are translated into Vivid
cylinders (cones) but their ends are not "capped" as they are in
Autocad. Circular surfaces can be modelled using the v_disk block (see
above), and cylinders can be capped in the same way. This
implementation was chosen because it allowed easy creation of cylinders
without caps.
AC2VIV will recognize and translate the following Autocad standard
entities:
<3dfaces>
3dfaces will be translated to Vivid polygons. Since it is possible
under Autocad to create 4-sided 3dfaces whose vertices do not lie on a
plane, when this situation is detected, the translator will split the
3dface into two 3-sided polygons.
<Lines>
Thick lines will be translated into Vivid polygons.
<2dpolylines>
2dpolylines which are thick, wide or both are translated into Vivid
polygons. If a polyline is both thick and wide, surfaces are placed at
the "ends", "tops", and "bottoms" as well. If a polyline contains arcs
of constant width these are translated into clipped cones and rings.
(Donuts will translate fine.) Variable width arcs are not currently
supported.
<Circles>
Circles with thickness are translated to Vivid cones w/ a single radius
(cylinders). The ends are not capped, use v_disk blocks (see above)
to cap them.
-6-
<Arcs>
Arcs with thickness are translated to clipped Vivid cones (cylinders).
<Solids>
Both solids and solids with thickness are translated into Vivid
polygons. Thick solids have "tops", "bottoms", "ends" and "sides".
<Meshes>
Both 3d_meshes and polyface meshes (the type produced by AME) are
translated. By default, meshes are translated as 3 or 4-sided Vivid
polygons. Meshes can also be tagged as "smoothed", in which case they
will translate as Vivid patches, causing them to appear as smooth
surfaces in the final output. Blocks can also be tagged as "smoothed",
in which case every mesh included within the block will be smoothed.
AC2VIV provides the following Autocad commands for manipulating meshes
(these are entered at the command prompt) :
facet-- Translate all meshes or blocks in a selection set as faceted
(default.)
smooth-- Translate all meshes or blocks in a selection set as smooth
objects.
smooth?-- Report the status of a selected mesh.
<<SOME IMPORTANT CONSIDERATIONS WHEN SMOOTHING MESHES>>
* There is a significant performance penalty for translating large
meshes as smooth objects. For example, a 50 x 50 mesh on a 486-33 w/
16 MB of memory took approximately 40 minutes to translate as a smooth
object. The same mesh translated as a faceted object in under 3
minutes. This performance penalty is greatly exaggerated if system
memory is at a premium and Autocad must make frequent use of the swap
file.
* Currently AC2VIV will not recognize any sharp corners in a smoothed
mesh and will try to make them round. If your mesh contains many sharp
corners it may actually create some geometrically inconsistent surfaces
which will confuse Vivid. This problem will be cleaned up in
subsequent releases, but currently the only workaround is to split
meshes with sharp corners into separate meshes.
* The objects which are created in Vivid are not true curves, the way
that light interacts with the surface will make them appear curved, but
shadows which they cast. and shadows which are cast upon them will be
faceted. This is normally not a problem but is something that should be
kept in mind. Wherever possible make use of the "v_" blocks provided
to create true smooth primitives (see above.)
-7-
<Blocks>
All Autocad blocks and nested blocks are supported, including Xrefs.
Blocks can be mirrored, rotated, moved, and placed in any UCS
orientation. They can also be scaled provided that the scale factor is
uniform for the X Y and Z axes (mirroring does not present a problem.)
-8-
2. ADDING THE STUDIO & LIGHTS
A. STUDIO STRUCTURE
A studio structure is added to the 3d model by inserting the block
V_STUDIO. This block comes in with attributes which define the studio
structure. Most of the Vivid studio structure is supported at this
time. (See below for items not currently supported.) Their values are
strictly text-- to respond to the UP parameter, for example, simply
type in a value such as "0 0 1" at the Autocad attribute prompt or
attribute entry dialogue box.
The scale and position of the studio structure are irrelevant, although
the "icon" is only a unit or two wide and may need to be scaled up to
be visible (or down to be less obtrusive). The studio block does not
need to be visible in the scene, <<BUT IT MUST NOT BE ON A LAYER WHICH
IS OFF OR FROZEN>>. Only the first V_STUDIO block encountered by the
translator will be processed, so be careful not to insert it more than
once or you may get some unexpected results. If no studio block is
inserted, there is a hard-coded default. The V_STUDIO block should not
be renamed.
Due to the nature of the Autocad attribute format, several parameters
are slightly different than they are in their native Vivid input
format. These are the switches such as "NO_EXP_TRANS" or "JITTER." An
attribute value of "Y" or "YES" will cause these switches to be present
in the Vivid input file, values of "N" or "NO" will cause them to be
absent.
The translator also adds the line
#include color.vc
before the studio structure. This permits use of Vivid's standard
color definitions, but requires that the color file be present in the
working directory when Vivid is run.
The following items in the studio are <<NOT>> currently supported by
this version of AC2VIV:
* The orthographic projection and the corresponding "width" parameter
* The "aperture", "focal_length", and "samples" group of parameters.
* "stop" and "start" line parameters. (These are available as command
line switches in Vivid 2.0.)
All of these may be manually added to the .v file produced by the
translator using a text editor.
-9-
B. LIGHTS
Lights are brought in much the same way as the studio structure. Four
blocks whose name begins with "L_" denote the four types of lights
available in Vivid. Each of these blocks contain appropriate
attributes for the particular light they represent. Similar to the
studio structure, the Vivid switches "NO_SHADOWS" and "NO_SPEC" use "Y"
or "N" attribute values to determine their presence or absence in the
.v input file.
<L_POINT>
This is Vivid's point light source. Its position is determined by the
insertion point of the block. The scale factor of the block is
ignored.
<L_DIRECT>
This is Vivid's directional light source. Its position and scale
factor are both ignored. The direction is given as text input, the
orientation of the block does not affect this.
<L_SPOT>
This is Vivid's spot light. It's position is given by the insertion
point, but its direction is currently specified by text, not by the
light's orientation. The scale factor is ignored.
<L_SPHERE>
This is Vivid's spherical light source. Its radius is determined by
the block's scale factor, and its position by the insertion point.
-10-
3. VIEWING THE MODEL
Before running the translator a perspective view of the model must be
created using the Autocad DVIEW command. If you are working with
multiple viewports, the viewport containing the view you wish to render
(a perspective view) must be made current. If you are working in
paperspace, the MSPACE command must first be issued and the desired
viewport made current.
Provided a "flat" projection, an "up" vector of 0 0 1, and a
"resolution" and "aspect" ratio close to your screen are provided to
Vivid via the studio structure, the resulting Vivid image will closely
match the view created within Autocad. Any lens length (DVIEW ZOOM)
should translate reasonably accurately. Here are some potential
problems:
* Autocad only supports one projection, a 3-point perspective similar
to Vivid's "flat" projection. Using one of Vivid's other methods will
yield varying results. The "spherical" projection will differ
significantly from the Autocad image. The "orthographic" projection is
currently not supported by the translator. The "parallax" , or 2-point
perspective, will yield an image which is still reasonably close to the
Autocad view, and any discrepancies are usually predictable.
* Using Autocad's VIEWTWIST option or Vivid's option of UP vectors
other than "0 0 1" may result in unpredictable views.
* Using Vivid aspect ratios other than your screen's aspect ratio
(usually 1.333), or resolution sizes which differ significantly from
your screen aspect ratio, will cause the Vivid view to render
differently than the Autocad view. These discrepancies are normally
predictable, so this may not prove to be too troublesome.
4. RUNNING THE TRANSLATOR
The translator is run by typing AC2VIV at the command prompt. An
output file name will be requested and the translator will append a
".v" file extension to the name provided. There is no check to see if
the file exists already, so be careful not to overwrite anything
important. The translator will step through the drawing database and
return a statistics screen upon completion, giving information about
the number and types of Autocad entities, and their resultant Vivid
primitives. The translation time is also reported.
-11-